<template>
  <div class="Index">
    <div class="hand">
      <h2 class="title">爆爆团</h2>
      <h1 class="time">限时爆款 超级低价</h1>
    </div>
    <div class="list">
      <div @click="one()">正在抢购</div>
      <div @click="oneon()">上新预告</div>
    </div>
    <div class="shop" v-for="(item, index) in onlist" :key="index">
      <div class="imgbox">
        <img :src="item.picture" alt="" />
      </div>
      <div class="text">
        <div class="name">{{ item.name }}</div>
        <div class="price">{{ item.min_price }}</div>
        <div class="num">{{ item.month_saled }}</div>
        <div class="km">{{ item.month_saled_content }}</div>
        <div>{{ item.promotion_info }}</div>
        <div>{{ item.unit }}</div>
      </div>
      <div class="push">
        <p @click="changePush(item, index)">
          {{ item.lq ? "已抢" : "马上抢" }}
        </p>
      </div>
    </div>
  </div>
</template>

<script>
import { tuanList } from "../api";

export default {
  data() {
    return {
      onlist: [],
      listtwo: [],
    };
  },
  mounted() {
    tuanList({ status: 0 }).then((res) => {
      console.log(res.data);
      this.onlist = res.data.list;
    });
  },
  methods: {
    one() {
      tuanList({ status: 0 }).then((res) => {
        console.log(res.data);
        this.onlist = res.data.list;
      });
    },
    oneon() {
      tuanList({ status: 1 }).then((res) => {
        console.log(res.data);
        this.onlist = res.data.list;
      });
    },
  },
};
</script>

<style scoped>
.title {
  width: 100%;
  height: 100px;
  background-color: red;
  text-align: center;
  border-bottom: 1px solid red;
  font-weight: bold;
  color: #fff;
}

.time {
  background-color: red;
  text-align: center;
  width: 100%;
  height: 60px;
  font-weight: bold;
  color: #fff;
}
.list {
  height: 50px;
  display: flex;
  align-items: center;
}
.list div{
  padding: 10px;
}
.buybox {
  margin-left: 20px;
}
.shop {
  display: flex;
  justify-content: space-between;
}
.shop img {
  width: 90px;
  margin: 5px 8px;
}
.shop .text {
  margin: 4px 0;
  flex: 1;
}
.push {
  margin-top: 30px;
  background-color: orangered;
  border-radius: 5px;
  height: 30px;
  text-align: center;
  line-height: 30px;
}
</style>